hvm: Correctly hook VLAPIC MSR change notification for VMX into
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Thu, 31 May 2007 08:49:53 +0000 (09:49 +0100)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Thu, 31 May 2007 08:49:53 +0000 (09:49 +0100)
save/restore path.
Signed-off-by: Keir Fraser <keir@xensource.com>
xen/arch/x86/hvm/vlapic.c
xen/arch/x86/hvm/vmx/vmcs.c
xen/arch/x86/hvm/vmx/vmx.c
xen/include/asm-x86/hvm/vmx/vmx.h

index 19ab01499ad46adb646b3b8419a60a58fa6c36c9..a63a0fd94efb99777d95486a8b0a90493d9cf4a8 100644 (file)
@@ -32,6 +32,7 @@
 #include <xen/lib.h>
 #include <xen/sched.h>
 #include <asm/current.h>
+#include <asm/hvm/vmx/vmx.h>
 #include <public/hvm/ioreq.h>
 #include <public/hvm/params.h>
 
@@ -710,6 +711,8 @@ void vlapic_msr_set(struct vlapic *vlapic, uint64_t value)
 
     vlapic->hw.apic_base_msr = value;
 
+    vmx_vlapic_msr_changed(vlapic_vcpu(vlapic));
+
     HVM_DBG_LOG(DBG_LEVEL_VLAPIC,
                 "apic base msr is 0x%016"PRIx64, vlapic->hw.apic_base_msr);
 }
@@ -877,6 +880,9 @@ static int lapic_load_hidden(struct domain *d, hvm_domain_context_t *h)
         return -EINVAL;
 
     lapic_info(s);
+
+    vmx_vlapic_msr_changed(v);
+
     return 0;
 }
 
index 7d263985f8f309d68425fc89ab2d1a7d47d896b7..413981c061b89284c04268c8285df68201fb05d0 100644 (file)
@@ -456,6 +456,8 @@ static void construct_vmcs(struct vcpu *v)
     vmx_vmcs_exit(v);
 
     paging_update_paging_modes(v); /* will update HOST & GUEST_CR3 as reqd */
+
+    vmx_vlapic_msr_changed(v);
 }
 
 int vmx_create_vmcs(struct vcpu *v)
index 9d8ba90d0f35c29d360f9741df9e75d1130eeaa9..2aff3d295a66adf36700bdff354224bc0d7cca83 100644 (file)
@@ -2547,7 +2547,7 @@ static void vmx_install_vlapic_mapping(struct vcpu *v)
     vmx_vmcs_exit(v);
 }
 
-static void vmx_check_vlapic_msr(struct vcpu *v)
+void vmx_vlapic_msr_changed(struct vcpu *v)
 {
     struct vlapic *vlapic = vcpu_vlapic(v);
     uint32_t ctl;
@@ -2555,12 +2555,14 @@ static void vmx_check_vlapic_msr(struct vcpu *v)
     if ( !cpu_has_vmx_virtualize_apic_accesses )
         return;
 
+    vmx_vmcs_enter(v);
     ctl  = __vmread(SECONDARY_VM_EXEC_CONTROL);
     ctl &= ~SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES;
     if ( !vlapic_hw_disabled(vlapic) &&
          (vlapic_base_address(vlapic) == APIC_DEFAULT_PHYS_BASE) )
         ctl |= SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES;
     __vmwrite(SECONDARY_VM_EXEC_CONTROL, ctl);
+    vmx_vmcs_exit(v);
 }
 
 static inline int vmx_do_msr_write(struct cpu_user_regs *regs)
@@ -2591,7 +2593,6 @@ static inline int vmx_do_msr_write(struct cpu_user_regs *regs)
         break;
     case MSR_IA32_APICBASE:
         vlapic_msr_set(vcpu_vlapic(v), msr_content);
-        vmx_check_vlapic_msr(v);
         break;
     default:
         if ( !long_mode_do_msr_write(regs) )
index d1bdd3b95e26b33ad5d114f81186c499755b0f9d..37f4c4889d4140e90076287dc975c964a59c37ca 100644 (file)
@@ -32,6 +32,7 @@ void vmx_asm_do_vmentry(void);
 void vmx_intr_assist(void);
 void vmx_do_resume(struct vcpu *);
 void set_guest_time(struct vcpu *v, u64 gtime);
+void vmx_vlapic_msr_changed(struct vcpu *v);
 
 /*
  * Exit Reasons